﻿package org.example.spring06.utils;

import lombok.Data;

import java.util.logging.Logger;

/*
   代理数学工具类 写日志
 */
@Data
//@Component
public class MathUtilsProxy implements MathUtils{

    Logger logger = Logger.getLogger(MathUtilsProxy.class.getName());
    /*
             目标对象, 代理对象
     */
//    @Autowired
    MathUtils target;

    @Override
    public Integer add(Integer a, Integer b) {
        logger.info("add 方法入参:"+ a+","+b);
        Integer add = target.add(a, b);
        logger.info("add 返回值是:"+ add);
        return add;
    }

    @Override
    public Integer jian(Integer a, Integer b) {
        logger.info("jian 方法入参:"+ a+","+b);
        Integer jian = target.jian(a, b);
        logger.info("jian 返回值是:"+ jian);
        return jian;
    }

    @Override
    public Integer cheng(Integer a, Integer b) {
        logger.info("cheng 方法入参:"+ a+","+b);
        Integer cheng = target.cheng(a, b);
        logger.info("cheng 返回值是:"+ cheng);
        return cheng;
    }

    @Override
    public Integer chu(Integer a, Integer b) {
        logger.info("chu 方法入参:"+ a+","+b);
        Integer chu = target.chu(a, b);
        logger.info("chu 返回值是:"+ chu);
        return chu;
    }
}
